package com.likou.second_challenge;

public class q206 {

    public ListNode reverseList(ListNode head) {
        ListNode p1 = null;
        ListNode p2 = head;

        while (p2 != null) {
            ListNode temp = p2.next;
            p2.next = p1;
            p1 = p2;
            p2 = temp;
        }

        return p1;
    }

}
